package com.hongkzh.www.adv.controller;

import com.hongkzh.www.adv.service.CarouselService;
import com.hongkzh.www.conmon.ReqResponse;
import com.hongkzh.www.swagger.annotation.*;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

/**
 * @author martins
 */
@Api(tag = "carousel", description = "乐看主页轮播图")
public class CarouselController extends Controller {
    static CarouselService carouselService=new CarouselService();
    @ApiOperation(url = "/v1/carousel/getCarouselList", tag = "carousel", httpMethod = "post",description = "获取轮播图")

    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ imgSrc 图片地址 ,imgLinks 图片链接 imgRank 图片排序  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void getCarouselList(){
        ReqResponse<List<Record>> r=new ReqResponse();
        List<Record>  record= carouselService.getCarouselList();
        r.setData(record);
        renderJson(r);
    }
    @ApiOperation(url = "/v1/carousel/getCategoryList", tag = "carousel", httpMethod = "post",description = "获取主页分类")

    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ imgSrc 图片地址 ,imgLinks H5链接 imgRank 图片排序 category 分类名称  id  ,type  1自媒体 2企业广告3城市广告4传统文化 10 h5 }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void getCategoryList(){
        ReqResponse<List<Record>> r=new ReqResponse();
        List<Record>  record= carouselService.getCategoryList();
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/carousel/getEnterpriseCarouselList", tag = "carousel", httpMethod = "post",description = "获取企业广告轮播图")

    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ imgSrc 图片地址 ,imgLinks 图片链接 imgRank 图片排序  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void getEnterpriseCarouselList(){
        ReqResponse<List<Record>> r=new ReqResponse();
        List<Record>  record= carouselService.getEnterpriseCarouselList();
        r.setData(record);
        renderJson(r);
    }
}
